package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Mpac;

public class MpacDaoImpl extends HibernateDaoSupport implements MpacDao {

	
	public void save(Mpac mpac) {
		getSession().saveOrUpdate(mpac);
	}

	public Mpac load(int id) {
		Mpac mpac = (Mpac)getSession().load(Mpac.class, id);
		return mpac;
	}
	
	
	public List<Mpac> loadAll() {
		Query query = getSession().createQuery("from Mpac mpac");
		query.setCacheable(true);
		List<Mpac> list = (List<Mpac>)query.list();
		return list;
	}

	
	public void delete(Mpac mpac) {
		getSession().delete(mpac);
	}
	
}
